package com.wei.util;

public class MD implements Count{
    char arr[]={'*','/'};
    String s;
    double sum;


    public String calculate() {//获取运算表达式
        int x = (int) (Math.random() * 2);
        int number1 = (int)(Math.random() * 101);
        int number2 = (int)(Math.random() * 101);

        if(x==0){
            sum=(double)number1*number2;
        }else{
            if(number2!=0){
                sum=(double)number1/number2;
            }else{
                number2 = (int)(Math.random() * 100+1);
                sum=(double)number1/number2;
            }
        }
        String s =  number1 +""+ arr[x] + number2+"=";
        return s;
    }

    public double answer(){//获取结果
        sum = (double) Math.round(sum * 100) / 100;
        return sum;
    }

}
